package com.qdu.servlet;

import com.qdu.entity.Comment;
import com.qdu.service.CommentService;
import com.qdu.service.impl.CommentServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Ice
 */
@WebServlet("/urs")
public class UpdateRatingServlet extends HttpServlet {

    CommentService commentService = new CommentServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        float rating = Float.parseFloat(req.getParameter("rating"));
        int cid=Integer.parseInt(req.getParameter("cid"));
        
        Comment comment=new Comment(cid,rating);
        
        int rows=commentService.updateExistComment(comment);
        
        resp.getWriter().println(rows);
    }

}
